package net.borderwars.userserver;

import java.io.Serializable;

/**
 * @author ehubbard
 *         Date: Mar 10, 2006
 *         Time: 1:52:12 PM
 */
public class InvocationResult implements Serializable {
    Object rtn = null;
    Throwable e = null;
    private Long id;
    private static final long serialVersionUID = 4508495265423224649L;

    public InvocationResult(final Object rtn, Long id) {
        this.id = id;
        this.rtn = rtn;
    }

    public Long getId() {
        return id;
    }

    public InvocationResult(final Throwable e, Long id) {
        this.e = e;
        this.id = id;
    }

    public boolean hadException() {
        return (this.e != null);
    }

    public Throwable getException() {
        return (e);
    }

    public Object getResult() {
        return (rtn);
    }

    public String toString() {
        if (hadException()) {
            return (getException().toString());
        } else {
            return ("Result " + getResult());
        }

    }
}
